package com.jy.adscm.hcPlan.mapper.mysql;

import com.jy.adscm.hcPlan.bean.HcPlanMaterielPrice;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 物料采购财务报表 Mapper 接口
 * </p>
 *
 * @author yyy
 * @since 2018-08-24
 */
public interface HcPlanMaterielPriceMapper extends BaseMapper<HcPlanMaterielPrice> {

    /**
     * 获取指定日期内的所有已经审核通过的花费金额
     * @param beginDate
     * @param endDate
     * @return
     */
    @Select("SELECT SUM(price.puchase_price) puchase_price FROM hc_plan_materiel_price price " +
            "WHERE price.materiel_purchase_time >= #{beginDate} AND price.materiel_purchase_time <= #{endDate} AND price.audit_pass = 1")
    public Double getAllPriceByDate(@Param("beginDate") String beginDate,@Param("endDate") String endDate);


    List<HcPlanMaterielPrice> getMaterielPricesByMergeIds(@Param("mergeIds") List<String> mergeIds);
}
